package com.lcf.order.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.MultipartConfigElement;

/**
 * 设置上传文件的限制大小
 * Created by lancf on 2019/8/5.
 */
public class UploadFileConfig {

    @Configuration
    public class UploadConfig {

        @Bean
        public MultipartConfigElement multipartConfigElement() {
            MultipartConfigFactory factory = new MultipartConfigFactory();
            //单个文件最大
            factory.setMaxFileSize("20480KB"); //KB,MB
            /// 设置总上传数据总大小
            factory.setMaxRequestSize("1024000KB");
            return factory.createMultipartConfig();
        }
    }

}
